import request from '@/utils/request.js'

// 分类：获取文章分类
export const getChannelListService = () => request.get('/my/cate/list')

// 分类：添加文章分类
export const artEditChannelService = ({ id, cate_name, cate_alias }) =>
  request.put('/my/cate/info', {
    id,
    cate_name,
    cate_alias
  })

// 分类：编辑文章分类
export const artAddChannelService = ({ cate_name, cate_alias }) => {
  request.post('/my/cate/add', {
    cate_name,
    cate_alias
  })
}

// 分类：删除文章分类
export const artDeleteChannelService = ({ id }) =>
  request.delete('/my/cate/del', {
    params: {
      id
    }
  })

// 文章：获取文章列表
export const artGetListService = (params) =>
  request.get('/my/article/list', {
    params
  })

export const artPublishService = (data) => request.post('/my/article/add', data)

export const artGetDetailService = (id) =>
  request.get('/my/article/info', {
    params: {
      id
    }
  })

export const artEditService = (data) => request.put('my/article/info', data)
